<div id="gift" class="tab-pane gift-tab-pane">
    <div class="row">
        <div class="col-md-12">
            <form id="wizardForm" class="form-horizontal" method="post" action="" enctype="multipart/form-data">
                {{ csrf_field() }}
                <input type="hidden" value="entity" name="data[prize][type_code]">
                <input type="hidden" value="1" name="data[prize][resource]">
                <div class="row">
                    <div class="col-xs-4 app">
                        <div class="phone-view">
                            <div class="app-view">
                                <div class="app-mainC">
                                    <div class="app-alert">
                                        <div class="app-alert-input">
                                            <div class="app-alert-image">
                                                <img src="/images/admin/promotion_default.png">
                                            </div>
                                            <div class="app-alert-title">
                                                <div class="title-name">奖品名称</div>
                                                <div class="title-endtime">有效期:
                                                </div>
                                                <div class="title-endtime"><span class="title-endtime-span"></span>
                                                </div>
                                            </div>

                                        </div>
                                        <div class="app-alert-scene-word">
                                            <div class="app-alert-scene-text">
                                                线下门店兑换（当面核销有效）
                                            </div>
                                            <div>兑奖地址:<span class="title-sence-address"></span></div>

                                        </div>
                                        <div class="app-alert-mail-word displayable">
                                            <div class="app-alert-mail-text">
                                            </div>
                                            <div class="app-alert-mail-recipientName app-mail-manname">
                                                请输入收件人姓名
                                            </div>
                                            <div class="app-alert-mail-recipientName app-mail-tell">
                                                请输入收件人手机号
                                            </div>
                                            <div class="app-alert-mail-address app-mail-address">
                                                请输入邮寄地址
                                            </div>

                                        </div>

                                    </div>
                                    <div class="app-btn"></div>
                                    <div class="app-paper"></div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-xs-8">
                        <div class="row">
                            <div class="col-sm-12">
                                <div class="form-group">
                                    <label class="col-sm-2 col-sm-offset-1 control-label">奖品名称</label>
                                    <div class="col-sm-7 col-sm-offset-1">
                                        <input class="form-control prize-mail-name" type="text" name="data[prize][name]"
                                               required="required" datatype="s1-20" ajaxurl="/web/prize/checkName/0">
                                        <div class="info"><span
                                                    class="Validform_checktip"></span><span
                                                    class="dec"><s class="dec1">&#9670;</s><s
                                                        class="dec2">&#9670;</s></span></div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 col-sm-offset-1 control-label">有效时间</label>
                                    <div class="col-sm-7 col-sm-offset-1">
                                        <div class="row service-charges">
                                            <div class="col-md-5 service-charges-name service-charges-name-0"
                                                 style="padding-left: 15px;">
                                                <input type="text" placeholder="开始时间" required=""
                                                       name="data[prize][expired_start]" data-msg="请输入开始时间"
                                                       class="form-control datetimepicker mailstartdate" datatype="*">
                                                <div class="info"><span
                                                            class="Validform_checktip"></span><span
                                                            class="dec"><s class="dec1">&#9670;</s><s class="dec2">&#9670;</s></span>
                                                </div>
                                            </div>
                                            <div class="col-md-5 service-charges-remark service-charges-remark-0">
                                                <input type="text" placeholder="开始时间" required=""
                                                       name="data[prize][expired_end]" data-msg="请输入开始时间"
                                                       class="form-control datetimepicker mailenddate" datatype="*">
                                                <div class="info"><span
                                                            class="Validform_checktip"></span><span
                                                            class="dec"><s class="dec1">&#9670;</s><s class="dec2">&#9670;</s></span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 col-sm-offset-1 control-label">奖品库存</label>
                                    <div class="col-sm-7 col-sm-offset-1">
                                        <input class="form-control" type="number" placeholder="最大为9999999"
                                               required="required" name="data[prize][stock_number]" number="true"
                                               max="9999999" min="0" datatype="/^[1-9][0-9]{0,6}$/"
                                               errormsg="只能输入1~9999999的数字">
                                        <div class="info"><span
                                                    class="Validform_checktip"></span><span
                                                    class="dec"><s class="dec1">&#9670;</s><s
                                                        class="dec2">&#9670;</s></span></div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 col-sm-offset-1 control-label">兑奖方式</label>
                                    <div class="col-sm-7 col-sm-offset-1">
                                        {{--<label class="radio-inline">--}}
                                            {{--<input type="radio" name="data[prize][exchange_method]" class="senceprize"--}}
                                                   {{--value="0" checked>--}}
                                            {{--现场兑奖--}}
                                        {{--</label>--}}
                                        <label class="radio-inline">
                                            <input type="radio" name="data[prize][exchange_method]" class="mailprize"
                                                   value="1" checked>
                                            邮寄兑奖
                                        </label>
                                    </div>
                                </div>
                                {{--<div class="senceprize-input">--}}
                                    {{--<div class="form-group">--}}
                                        {{--<label class="col-sm-2 col-sm-offset-1 control-label">现场兑换地址</label>--}}
                                        {{--<div class="col-sm-7 col-sm-offset-1">--}}
                                            {{--<input class="form-control sence-prize-address" type="text"--}}
                                                   {{--placeholder="请填写地址" name="data[prize][exchange_address]"--}}
                                                   {{--ignore="ignore">--}}
                                            {{--<div class="info"><span--}}
                                                        {{--class="Validform_checktip"></span><span--}}
                                                        {{--class="dec"><s class="dec1">&#9670;</s><s--}}
                                                            {{--class="dec2">&#9670;</s></span></div>--}}
                                        {{--</div>--}}
                                    {{--</div>--}}
                                {{--</div>--}}

                                {{--<div class="form-group">--}}
                                    {{--<label class="col-sm-2 col-sm-offset-1 control-label">奖品标签</label>--}}
                                    {{--<div class="col-sm-7 col-sm-offset-1">--}}
                                        {{--<textarea class="form-control" type="text" name="data[prize][tag]"></textarea>--}}
                                        {{--<div class="info"><span--}}
                                                    {{--class="Validform_checktip"></span><span--}}
                                                    {{--class="dec"><s class="dec1">&#9670;</s><s--}}
                                                        {{--class="dec2">&#9670;</s></span></div>--}}
                                    {{--</div>--}}
                                {{--</div>--}}
                                <div class="form-group backgroundImg-container">
                                    <label class="col-sm-2 col-sm-offset-1 control-label">奖品图片</label>
                                    <div class="col-sm-7 col-sm-offset-1">
                                        <input type="file" name="upfile" accept="image/gif,image/jpeg,image/png"
                                               data-target="uploadImageFile"
                                               data-preview-file-type="text" class="form-control fileInput" value=""
                                               title="" data-for="data[prize][background_image]" maxFileSize="200K"
                                               maxImageWidth="100" maxImageHeight="100">
                                        <input type="hidden" name="data[prize][background_image]" value="">
                                        <span class="help-block">100*100像素，支持PNG、JPG格式，小于200KB</span>
                                        <div class="info"><span
                                                    class="Validform_checktip"></span><span
                                                    class="dec"><s class="dec1">&#9670;</s><s
                                                        class="dec2">&#9670;</s></span></div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-sm-10 col-sm-offset-1">
                                        <div class="panel panel-info">
                                            <div class="panel-heading">
                                                <h3 class="panel-title">奖品赞助商信息</h3>
                                            </div>
                                            <div class="panel-body sponsor_panel">
                                                <div class="sponsor_form">
                                                    <div class="row">
                                                        <div class="col-sm-12">
                                                            <img src="/images/admin/delet_red.png"
                                                                 class="sponsor_delet pull-right mgb10 mgr30">
                                                        </div>
                                                        <div class="form-group">
                                                            <label class="col-sm-3 control-label">赞助商信息</label>
                                                            <div class="col-sm-8 ">
                                                                <input class="form-control" type="text"
                                                                       name="data[sponsor][name][]" datatype="sponsor">
                                                                <div class="info"><span
                                                                            class="Validform_checktip"></span><span
                                                                            class="dec"><s
                                                                                class="dec1">&#9670;</s><s
                                                                                class="dec2">&#9670;</s></span>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="form-group">
                                                            <label class="col-sm-3 control-label">商家Logo</label>
                                                            <div class="col-sm-8">
                                                                <input type="file" name="upfile"
                                                                       accept="image/gif,image/jpeg,image/png" data-target="uploadLogoFile"
                                                                       data-preview-file-type="text"
                                                                       class="form-control fileInput" value="" title=""
                                                                       maxFileSize="200K" maxImageWidth="100"
                                                                       maxImageHeight="100"
                                                                       data-for="data[sponsor][logo][]">
                                                                <input type="hidden" name="data[sponsor][logo][]"
                                                                       value="">
                                                                <span class="help-block">支持PNG、JPG格式，小于200KB</span>
                                                                <div class="info"><span
                                                                            class="Validform_checktip"></span><span
                                                                            class="dec"><s
                                                                                class="dec1">&#9670;</s><s
                                                                                class="dec2">&#9670;</s></span>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="form-group">
                                                            <label class="col-sm-3 control-label">曝光率</label>
                                                            <div class="col-sm-7">
                                                                <input class="form-control ptr" type="number"
                                                                       name="data[sponsor][percent][]"
                                                                       datatype="/^100$|^[0-9]{1,2}$/" min="0" value="0"
                                                                       errormsg="只能输入0~100的整数">
                                                                <div class="info"><span
                                                                            class="Validform_checktip"></span><span
                                                                            class="dec"><s
                                                                                class="dec1">&#9670;</s><s
                                                                                class="dec2">&#9670;</s></span>
                                                                </div>
                                                            </div>
                                                            <label class="col-sm-1 control-label ptl textl">%</label>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="pull-center mgud">
                                                    <button type="button"
                                                            class="btn btn-info btn-wd btn-finish panel-sponsor-butten">
                                                        添加一个新的赞助商
                                                    </button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
                <div class="footer pull-center">

                    <button type="submit" class="btn btn-submit btn-info btn-fill btn-wd btn-finish sponsor_sur">
                        完成
                    </button>

                    <div class="clearfix"></div>
                </div>
            </form>
        </div>
    </div>
</div>


<script>
	function init() {
		$('.senceprize').click(function () {

			$('.senceprize-input').removeClass('displayable');
			$('.app-alert-mail-word').addClass('displayable');
			$('.app-alert-scene-word').removeClass('displayable');
		});
		$('.mailprize').click(function () {
			$('.app-alert-mail-word').removeClass('displayable');
			$('.senceprize-input').addClass('displayable');
			$('.app-alert-scene-word').addClass('displayable');
		});
		$('.panel-sponsor-butten').click(function () {
			var addObj = $(this).parent('.mgud');
			$.get('/web/prize/sponsor', function (res) {
				addObj.before(res);
				var fileInputObj = addObj.prev('.sponsor_form').find('.fileInput');
				initFileInput(fileInputObj);
			});
		});
		$('.sponsor_panel').on('click', '.sponsor_delet', function () {
			if ($('.sponsor_form').length == 1) {
				return;
			}
			$(this).parents('.sponsor_form').remove();
		});
		$('.prize-mail-name').blur(function () {
			if ($('.prize-mail-name').val() == '') {
				$('.title-name').empty();
				$('.title-name').html('活动名称');
			}
		});
		$('.prize-mail-name').on('input', function () {
			$('.title-name').empty();
			var name = $('.prize-mail-name').val();
			$('.title-name').html(name);
		});

//		$('.mailenddate').on('input', function () {
//			var enddate = $(this).val();
//			$('.title-endtime-span').html(enddate);
//		});
		$('.datetimepicker').on('blur', function () {
			var enddate = $(this).val();
			$('.title-endtime-span').html(enddate);
		});


		$('.sence-prize-address').blur(function () {
			if ($('.sence-prize-address').val() == '') {
				$('.title-sence-address').empty();
				$('.sence-prize-address').attr('placeholder', '请填写地址');
			}
		});
		$('.sence-prize-address').on('input', function () {
			$('.title-sence-address').empty();
			var name = $('.sence-prize-address').val();
			$('.title-sence-address').html(name);
		});

		$('.fileInput').each(function () {
			initFileInput($(this));
		});

		$(".datetimepicker").datetimepicker({format: 'YYYY-MM-DD hh:mm:ss'});

		initValidform($('#wizardForm'));
	}
</script>

